﻿Public Module ADOXUtils
    Public Function GetColumnsDescription(ByVal connStr As String, ByVal tableName As String) As DataTable
        Try
            Dim data As New DataTable
            data.Columns.Add("COLUMN_NAME", GetType(String))
            data.Columns.Add("COMMENTS", GetType(String))
            Dim Catalog = CreateObject("ADOX.Catalog")
            Catalog.ActiveConnection = connStr
            Dim columns = Catalog.Tables(tableName).Columns
            For Each col In columns
                data.Rows.Add(col.Name, col.Properties("Description").Value)
            Next
            Return data
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
End Module
